package cn.javaeye.lonlysky.lforum.entity.web;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.xidea.lite.servlet.DateUtils;

import cn.javaeye.lonlysky.lforum.entity.forum.Users;

@Entity
@Table(name = "t_article")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Article implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4191660316095112796L;
	private Integer id;
	/**
	 * 类别
	 */
	private ParentType parentType; 
	/**
	 * 发布日期
	 */
	private String infoDate=DateUtils.getDateStr();
	/**
	 * 访问量
	 */
	private String times ="0";

	/**
	 * 内容
	 */
	private String content;
	/**
	 * 标题
	 */
	private String title;
	/**
	 * 发布者
	 */
	private Users user;
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "increment")
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "pid", unique = false, nullable = false, insertable = true, updatable = true)
	public ParentType getParentType() {
		return parentType;
	}
	public void setParentType(ParentType parentType) {
		this.parentType = parentType;
	}
	@Column(name = "infoDate", unique = false, nullable = true, insertable = true, updatable = true)
	public String getInfoDate() {
		return infoDate;
	}
	public void setInfoDate(String infoDate) {
		this.infoDate = DateUtils.getDateStr();
	}
	@Column(name = "time", unique = false, nullable = true, insertable = true, updatable = true)
	public String getTimes() {
		return times;
	}
	public void setTimes(String times) {
		this.times = times;
	}
	@Column(name = "conent", unique = false, nullable = true, insertable = true, updatable = true)
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	@Column(name = "title", unique = false, nullable = false, insertable = true, updatable = true)
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "userid", unique = false, nullable = true, insertable = true, updatable = true)
	public Users getUser() {
		return user;
	}
	public void setUser(Users user) {
		this.user = user;
	}
	
	
}
